package com.cham.pdm.controller;

import com.cham.enums.ChamSysCodeEnum;
import com.cham.login.dto.LoginResultDTO;
import com.cham.pdm.service.UserService;
import com.cham.register.ChamRegistryDTO;
import com.cham.user.entity.User;
import com.cham.utils.TokenUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;

import java.util.UUID;

/**
 * @author Howl-Xu
 * @version 1.0.0
 * @Description: 请描述一下这个类文件吧
 * @createTime 2020年03月30日 08:54:00
 */
@Controller
@RequestMapping("/registerController")
public class RegisterController {

    @Autowired
    private UserService userService;


    @PostMapping("/register")
    @ResponseBody
    public ChamSysCodeEnum register(@RequestBody ChamRegistryDTO chamRegistryDTO){
        User user = new User();
        user.setAccount(chamRegistryDTO.getAccount());
        user.setPassword(chamRegistryDTO.getPassword());
        String uuid = UUID.randomUUID().toString().replaceAll("-","");
        user.setUserUuid(uuid);
        //userService.register(user);
        //userMapper.addUser(user);
        return userService.register(user);
    }
}
